package com.jksoft.meteo.data;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.imageio.ImageIO;

public class WeatherEntry {
	
	private BufferedImage icon;

	private String condition;
	private String day;
	private String high;
	private String iconURL;
	private String low;

	public WeatherEntry() {

	}

	public String getCondition() {
		return condition;
	}

	public String getDay() {
		return day;
	}

	public String getHighTemperature() {
		return high;
	}
	
	public BufferedImage getIcon() {
		return icon;
	}

	public String getIconURL() {
		return iconURL;
	}

	public String getLowTemperature() {
		return low;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public void setHighTemperature(String high) {
		this.high = high;
	}

	public void setIcon(String iconURL) {
		this.iconURL = iconURL;
		
		try {
			this.icon = ImageIO.read(new URL(iconURL));
		} catch (MalformedURLException e) {
			System.err.println("Malformed URL caught - WeatherEntry.");
			this.icon = null;
		} catch (IOException e) {
			System.err.println("IO exception caught - WeatherEntry.");
			this.icon = null;
		}
	}

	public void setLowTemperature(String low) {
		this.low = low;
	}
}
